package com.fz.controller;

import com.fz.entity.Product;
import com.fz.mapper.WebIndexMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by Z-C-Y on 2018-03-04.
 * 网站首页
 */
@Controller
public class WebIndexController {
    @Autowired
    protected WebIndexMapper webIndexMapper;

    @RequestMapping(value = "/webpage/index")
    public String show(Model model){
        /*首页的轮播图*/
        model.addAttribute("listCarousel",webIndexMapper.queryCarousel());

        /*向页面展示数据据中的----油画*/
        String s = "油画";
        List<Product> list =  webIndexMapper.indexYouHua(s);
        model.addAttribute("indexYouHua",list);

        /*向页面展示数据据中的----国画*/
        String ss = "国画";
        List<Product> list1 = webIndexMapper.indexGuoHua(ss);
        model.addAttribute("listGuoHua",list1);

        /*向页面展示数据据中的----书法*/
        String sss = "书法";
        List<Product> list2  = webIndexMapper.indexShuFa(sss);
        model.addAttribute("listShufa",list2);
        model.addAttribute("t","index");
        return "/webpage/index";
    }









 /*   @RequestMapping("/show")
    public ModelAndView index(HttpServletRequest request,HttpServletResponse response){
        ModelAndView retMap = new ModelAndView();
        System.out.println("首页ModelAndView");
         retMap.setViewName("/webpage/index.jsp");
        return retMap;
    }
*/



}
